home *** CD-ROM | disk | FTP | other *** search
- *****Listing 5*****
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <signal.h>
- #include <assert.h>
-
- void eh(void);
- void abort_hand(void);
-
- main()
- {
- char c;
-
- atexit(eh);
- if (signal(SIGABRT, abort_hand) == SIG_ERR) {
- printf("Can't register abort_hand\n");
- exit(1);
- }
-
- printf("Enter A (abort), E (exit): ");
- c = getchar();
-
- assert(c != 'A');
- }
-
- void eh(void)
- {
- printf("Inside eh\n");
- }
-
- void abort_hand(void)
- {
- printf("Inside abort_hand\n");
- exit(2);
- }
-
-